package com.bw.g3_619lx02.notice

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.lifecycle.lifecycleScope
import com.bw.g3_619lx02.R
import com.bw.g3_619lx02.databinding.ActivityNoticeBinding
import com.bw.lib_base.mvi.BaseActivity
import com.bw.lib_base.mvi.UiState
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch

@AndroidEntryPoint
class NoticeActivity : BaseActivity<ActivityNoticeBinding,NoticeIntent,NoticeViewModel>() {
    override val binding by lazy { ActivityNoticeBinding.inflate(layoutInflater) }

    override val vm by viewModels<NoticeViewModel>()



    override fun initView() {

        vm.sendIntent(NoticeIntent.getNotices(1,10))

    }

    override fun initData() {
        lifecycleScope.launch {
            //UI响应获取数据
            vm.uiState.collect{//通过判断uiState状态获取不同结果
                  when(it){
                      is UiState.onSuccess<*>->{

                      }

                      is UiState.Onerr->{

                      }

                      is UiState.onLoading->{

                      }

                  }
            }
        }

    }

}